<template>
  <div>
    <tb-report
      :columns="columns"
      :apiUrl="apiUrl"
      :searchParams="searchParams"
      :tableData="tableData"
      :getData="getData"
    ></tb-report>
  </div>
</template>

<script>
import TbReport from "@/components/tb-report/index.vue";

export default {
  name: "App",
  components: { TbReport },
  data() {
    return {
      title: "首页",
      apiUrl:"/scm/api/v1/scmSupplierTrainNumberInfo/list",
      searchParams:{
        weighingStorage:1
      },
      columns: [
      { type: 'seq', key: 'seq', width: 50, title: '序号', align: 'center', fixed: 'left' },
    {
      key: 'associationNum',
      title: '关联号',
      field: 'associationNum',
      width: 160,
    },
    {
      key: 'vehiclePackingListStatus',
      title: '关联状态',
      field: 'vehiclePackingListStatus',
      width: 100,
    },
    {
      key: 'supplier',
      title: '供应商名称',
      field: 'supplier',
      width: 100,
      // slots: {
      //   default: ({ row }) => {
      //     return [h('span', {}, row.supplierId ?vendorCorpJson.value[row.supplierId]  :'---')]
      //   },
      // },
    },
    {
      key: 'relateType',
      title: '关联类型',
      field: 'relateType',
      width: 120,
    },
    {
      key: 'gatherWharf',
      title: '集港码头',
      field: 'gatherWharf',
      width: 120,
    },
    { key: 'licensePlateNumber', title: '号码', field: 'licensePlateNumber', width: 100 },
    {
      key: 'estimatedArrivalTime',
      title: '预计到港时间',
      field: 'estimatedArrivalTime',
      width: 100,
    },
    {
      key: 'vehicleDepartureTime',
      title: '车辆出发时间',
      field: 'vehicleDepartureTime',
      width: 100,
    },
    { key: 'driverName', title: '驾驶员姓名', field: 'driverName', width: 100 },
    { key: 'driverPhone', title: '驾驶员电话', field: 'driverPhone', width: 100 },
    { key: 'driverIdNum', title: '司机身份证号', field: 'driverIdNum', width: 100 },
    { key: 'shippingCity', title: '发货城市', field: 'shippingCity', width: 100 },
    { key: 'gatherWharf', title: '集港码头', field: 'gatherWharf', width: 100 },
    { key: 'receivingAddress', title: '收货地址', field: 'receivingAddress', width: 100 },
    { key: 'totalNumber', title: '总件数', field: 'totalNumber', width: 100 },
    { key: 'totalVolume', title: '总体积', field: 'totalVolume', width: 100 },
    { key: 'totalGrossWeight', title: '总毛重(Kg)', field: 'totalGrossWeight', width: 100 },
      ],
      tableData:[]
    };
  },
  methods:{
    getData(data){
           if (this.tableData.length == 0) {
            this.tableData = data;
           } else {
            this.tableData = [...this.tableData, ...data];
          }
    }
  }
};
</script>

<style>
</style>
